public class demo01 {
    public static void main(String[] args) {
        //山
        int sum=0;
        for (int i = 2022; i <= 2022222022; i++) {
            String s1=i+"";
            if(check(s1)){
                sum++;
            }
        }
        System.out.println(sum);
    }
    public static boolean check(String s1){
        int left=0;
        int right=s1.length()-1;
        while (left<right){
            if((s1.charAt(left)!=s1.charAt(right))||(s1.charAt(left)>s1.charAt(left+1))){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
